﻿namespace NICWebApi.Extensions.JWT.Policy;

/// <summary>
/// WebApiRequirement类，用于定义WebApi的授权要求
/// </summary>
internal class WebApiRequirement : IAuthorizationRequirement
{
    public int Role { get; private set; }

    /// <summary>
    /// can be like "001001001,001002003"
    /// </summary>
    public string MenuCode { get; set; }

    /// <summary>
    /// can be like "updates","updates,confirm"
    /// </summary>
    public string BusinessStatus { get; set; }

    /// <summary>
    /// can be like "S","N,S"
    /// </summary>
    public string ActionCode { get; set; }

    /// <summary>
    /// WebApiRequirement类的构造函数，用于初始化WebApi的授权要求
    /// </summary>
    /// <param name="role"></param>
    /// <param name="menucode"></param>
    /// <param name="actioncode"></param>
    public WebApiRequirement(int role, string menucode = "", string actioncode = "")
    {
        Role = role;
        MenuCode = menucode;
        ActionCode = actioncode;
        // BusinessStatus = status;
    }
}